// 流程部署模块相关请求
// 导入request请求对象
import request from '@/utils/request'

// 请求后端获取流程部署分页列表信息
export function getProcDeployList(query) {
  return request({
    url: '/workFlow/loadAllDeployment',
    method: 'get',
    params: query
  })
}

// 请求后端获取流程定义分页列表信息
export function getProcDefList(query) {
  return request({
    url: '/workFlow/loadAllProcessDefinition',
    method: 'get',
    params: query
  })
}

// 添加流程部署
export function addWorkFlow(data) {
    return request({
        url: '/workFlow/addWorkFlow',
        method: 'post',
        data
    })
}

// 查看流程图
export function showDiagram(deploymentId) {
  return request({
    url: `/workFlow/findProcessImage/${deploymentId}`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}

// 查询我的待办任务列表
export function getMyTaskList(query) {
  return request({
    url: '/workFlow/loadCurrentUserTask',
    method: 'get',
    params: query
  })
}

// 删除流程部署和定义信息
export function deleteWorkFlow(deploymentId) {
  return request({
    url: `/workFlow/deleteWorkFlow/${deploymentId}`,
    method: 'get'
  })
}

// 批量删除流程部署信息
export function batchDeleteWorkFlow(ids) {
  return request({
    url: '/workFlow/batchDeleteWorkFlow',
    method: 'get',
    params: { 'ids': ids }
  })
}

// 根据任务ID查询请假单的信息
export function queryLeaveBillByTaskId(taskId) {
  return request({
    url: `/workFlow/queryLeaveBillByTaskId/${taskId}`,
    method: 'get'
  })
}

// 根据任务ID查询连线信息
export function queryOutcomeByTaskId(taskId) {
  return request({
    url: `/workFlow/queryOutcomeByTaskId/${taskId}`,
    method: 'get'
  })
}

// 根据任务ID查询批注信息
export function loadAllComments(taskId) {
  return request({
    url: `/workFlow/loadAllComments/${taskId}`,
    method: 'get'
  })
}

// 处理任务
export function doTask(data) {
  return request({
    url: '/workFlow/completeTask',
    method: 'post',
    data
  })
}



  
